Map from stat transformed data, flag evaluation of mapping for after data has been scaled, map the same aesthetic multiple times but remap it for the geom, and then convert it into ggplotly
p <-
ggplot(mpg, aes(displ)) +
geom_histogram(aes(y = after_stat(count)))
plotly::ggplotly(p)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
p <-
ggplot(mpg, aes(displ)) +
geom_histogram(aes(y = after_stat(count / max(count))))
plotly::ggplotly(p)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
p <-
ggplot(mpg, aes(class, hwy)) +
geom_boxplot(aes(colour = class, fill = after_scale(alpha(colour, 0.4))))
plotly::ggplotly(p)
p <-
ggplot(mpg, aes(class, hwy)) +
geom_boxplot(aes(fill = stage(class, after_scale = alpha(fill, 0.4))))
plotly::ggplotly(p)